﻿using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Compose;
using GalaSoft.MvvmLight.Messaging;

namespace ConsoleApplication1
{
    //[Export(typeof(CommandLine.ICommand))]
    //[ExportMetadata("CommandName", "计算")]

    [CommandLine.Command(CommandName = "计算")]
    public class Class2 : CmdLine
    {
  
        public override  string Execute(string input)
        {
            try
            {
                string res="结果是:"+ new DataTable().Compute(input, null).ToString();
                SendMsg("hello",res);
                return res;
            }
            catch (Exception ex)
            {

                return ex.Message ;
            }
           
        }

        public Class2():base("计算")
        {
        }

        public override void CallBack(string msg)
        {

            Console.WriteLine(mName + ":" + msg);
        }



        public override string ReceiveMsg(string msg)
        {
            Console.WriteLine(mName + ":" + msg);
            return null;
        }

        public override void Dispose()
        {
            base.Dispose();
        }



    }
}
